package com.smart.lib.service;

import com.smart.lib.entity.BookInfo;
import com.smart.lib.mapper.LLMMapper;
import com.smart.lib.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * AI自动化查询接口实现
 * */
@Service
public class LLMService {
    @Autowired
    LLMMapper llmMapper;

    /**
     * LLM根据语义提取关键字并进行查询
     * */
    public Response getBookInfoByAI(BookInfo bookInfo){
        List<BookInfo> books = llmMapper.getBookInfoByAI(bookInfo);
        HashMap<String,Object> hm = new HashMap<>();
        hm.put("booklist",books);
        hm.put("count",books.size());
        return new Response(200,"查询知识库成功",hm);
    }
}
